package win.bitterwine.serviceImpl;

import org.smart4j.framework.orm.DataSet;
import org.smart4j.framework.tx.annotation.Service;
import org.smart4j.framework.tx.annotation.Transaction;
import win.bitterwine.entity.B_roles;
import win.bitterwine.service.B_rolesService;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/6/15.
 */
@Service
public class B_rolesServiceImpl implements B_rolesService {
    @Override
    public List<B_roles> findRolesList() {
        return DataSet.selectList(B_roles.class);
    }

    @Override
    public B_roles findRoles(long id) {
        return DataSet.select(B_roles.class, "id = ?",id);
    }

    @Override
    @Transaction
    public boolean saveRoles(Map<String, Object> fieldMap) {
        return DataSet.insert(B_roles.class,fieldMap);
    }

    @Override
    @Transaction
    public boolean updateRoles(long id, Map<String, Object> fieldMap) {
        return DataSet.update(B_roles.class, fieldMap, "id = ?",id);
    }

    @Override
    @Transaction
    public boolean deleteRoles(long id) {
        return DataSet.delete(B_roles.class, "id = ?", id);
    }
}
